<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('关联供应商')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="materialReplace-form">
                <input id="id" name="id" type="hidden" th:field="*{materialReplace.rawMaterialId}"/>
                <div class="select-list">
                    <ul>
                        <li>
                            替换料编码：<input name="newMaterialCode" type="text"/>
                        </li>
                        <li>
                            替换料名称：<input name="newMaterialName" type="text"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间： </label>
                            <input class="time-input" id="startTime" name="params[beginTime]" placeholder="开始时间"
                                   type="text"/>
                            <span>-</span>
                            <input class="time-input" id="endTime" name="params[endTime]" placeholder="结束时间"
                                   type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 search-collapse">
            <div class="select-list">
                <ul>
                    <li>
                        <label>物料编码：</label>
                            <input type="text" name="materialCode" id="materialCode"
                                   th:field="*{material.code}" disabled>
                    </li>
                    <li>
                        <label>物料名称：</label>
                            <input type="text" name="materialName" id="materialName"
                                   th:field="*{material.name}" disabled>
                    </li>
                </ul>
            </div>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add($('#id').val())"
               shiro:hasPermission="system:material:addMaterialReplaceSave">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:vendor:editMaterialReplaceSave">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:vendor:removeMaterialReplaceSave">
                <i class="fa fa-remove"></i> 批量冻结
            </a>
            <a class="btn btn-danger" onclick="closeItem()">
                <i class="fa fa-reply-all"></i> 关闭
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/material";

    $("#startTime").val(getDay(-14));
    $("#endTime").val(nowTime());

    $(function () {
        var options = {
            url: prefix + "/viewMaterialReplace",
            createUrl: prefix + "/addMaterialReplaceSave/{id}",
            updateUrl: prefix + "/editMaterialReplaceSave/{id}",
            removeUrl: prefix + "/removeMaterialReplaceSave",
            sortName: "createTime",
            modalName: "关联供应商",
            uniqueId: "id",
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {
                    title: '替换料颜色',
                    field: 'newMaterial.color'
                },
                {
                    title: '替换料类型',
                    field: 'type'
                },
                {
                    title: '替换料编码',
                    field: 'newMaterial.code'
                },
                {
                    title: '替换料名称',
                    field: 'newMaterial.name'
                },
                {
                    field: 'createBy',
                    title: '创建人'
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    field: 'updateBy',
                    title: '修改人'
                },
                {
                    field: 'updateTime',
                    title: '修改时间',
                    sortable: true
                },
                {
                    title: '备注',
                    field: 'remark'
                }
            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>